home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 17
/
AMIGAplus Sonderheft 17 (1999)(ICP)(DE)[!].iso
/
PD
/
Anwendungen
/
IxGuide
/
docs
/
ixclient_1.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-03-22
|
3KB
|
143 lines
/* Sample arexx client program for iX-Guide. */
/* This client receives all events available */
/* from iX-Guide and prints message on every */
/* event */
if ~show('l', "rexxsupport.library") then
addlib('rexxsupport.library',0,-30,0)
OPTIONS RESULTS
/*
** Every rexx client receives pointer to iXG window as the last argument
** in form 'iXW=<address>'. That is the window the rexx client was launched
** from. You always have to pass this pointer to ADDCLIENT !
*/
PARSE ARG 'iXW=' windowPTR .
/*
** Port name of every rexx client should be in the following form:
** "IXCL_anythingyouwant_windowPTR"
*/
portname = "IXCL_demoCL1_"
portname = INSERT(windowPTR,portname,LENGTH(portname))
/************************************************************************/
if show('p',portname) then exit /* we are already running */
ADDRESS IXGUIDE
/*
** Add this client to iX-Guide and pass received window pointer
*/
AddClient windowPTR
/************************************************************************/
call openport(portname)
setport portname KEYBOARD MOUSE MISC VGUPDATE
AllocRaster 1
rp=result
Refresh rp
Move rp 0 10
shutdown=0
yc=10
do until shutdown
call waitpkt(portname)
msg = getpkt(portname)
if msg ~= '0000 0000'x then do
cmd = getarg(msg)
if cmd='0000 0000'x then shutdown=1 /* pointer to window is NULL */
else if cmd=windowPTR then do /* this is message from our window */
cmd = getarg(msg,1)
if cmd='MOUSE' then do
a1=getarg(msg,2)
a2=getarg(msg,3)
a3=getarg(msg,4)
say 'MOUSE EVENT [ROBJ='a1',X='a2',Y='a3']'
if a1=1 then do
Move rp a2 a3
SetABPen rp 2 1
Text rp 'Arexx'
end
end
if cmd='KEYBOARD' then do
a4=getarg(msg,2)
if a4='RAWKEY' then do
a1=getarg(msg,3)
a2=getarg(msg,4)
say 'KEYBOARD EVENT Rawkey ['a1':'a2']'
end
else do
a1=getarg(msg,3)
say 'KEYBOARD EVENT Vanilla ['d2c(a1)']'
if a1=13 then do
yc=yc+10
Move rp 0 yc
end
if a1=32 then Text rp '" "'
SetABPen rp 1 0
Text rp d2c(a1)
end
end
if cmd='VGUPDATE' then do
a1=getarg(msg,2)
a2=getarg(msg,3)
say 'VGUPDATE EVENT Left 'a1' Top 'a2
end
if cmd='MISC' then do
a4=getarg(msg,2)
if a4='QUIT' then do
shutdown=1
say 'QUIT EVENT'
end
if a4='CLOSEWIN' then do
shutdown=1
say 'CLOSE WINDOW EVENT'
end
if a4='WINRESIZED' then
say 'WINRESIZED EVENT'
if a4='LINKREQ' then do
a5=getarg(msg,3)
say 'LINK REQUESTED Name ['a5']'
end
if a4='LINKOK' then do
a5=getarg(msg,3)
a6=getarg(msg,4)
say 'LINK SUCCEDED Database name ['a5'] Node name ['a6']'
end
if a4='LINKFAILED' then do
a5=getarg(msg,3)
a6=getarg(msg,4)
say 'LINK FAILED EVENT Database name ['a5'] Node name ['a6']'
end
if a4='ASKSCREEN' then say 'User asked for new screen'
if a4='NEWSCREEN' then do say 'Screen changed !'; shutdown=1; end
if a4='OLDSCREEN' then say 'New screen failed...'
end
end
call reply(msg,0)
end
end
/*
** Clean up
*/
FreeRaster rp
RemClient
call closeport(portname)